package wangwenjun.phase1.interrupt;

import util.ThreadUtil;

/**
 * @author ChangLiang
 * @date 2020/5/29
 */
public class ThreadInterruptedV1 {

    public static void main(String[] args) {
        Thread thread = new Thread()
        {
            @Override
            public void run()
            {
                while (true)
                {
                    System.out.println(Thread.interrupted());
                }
            }
        };
        thread.setDaemon(true);
        thread.start();

        //shortly block make sure the thread is started.
        ThreadUtil.sleepForMilliSeconds(2);
        thread.interrupt();
    }

    //output: 在很多的false 包围中发现了一个true

}
